package com.squareup.moshi

class BooleanAdapter {

    @FromJson
    fun fromJson(value: String?): Boolean {
        return if (value.isNullOrEmpty()) false
        else value == "1"
    }

    @ToJson
    fun toJson(value: Boolean) = if (value) 1 else 0

}